class TurboDeviseController < ApplicationController
class Responder < ActionController::Responder
def to_turbo_stream
controller.render(options.merge(formats: :html))
rescue ActionView::MissingTemplate => e
if get?
raise e
elsif has_errors? && default_action
render rendering_options.merge(formats: :html, status: :unprocessable_entity)
else
redirect_to navigation_location
end
end
end
self.responder = Responder
respond_to :html, :turbo_stream
end
# TurboFailureApp
# see: config/initializers/devise_turbo.rb
# https://github.com/klueless-io/rails_app_generator/blob/main/templates/addons/devise/config/initializers/devise_turbo.rb